<script>
import {getRegistList} from '@/api/doctor/doctor'
  export default {
    props:['type'],
    data(){
        return{
          registerList:[]
        }
    },
    methods:{
      rowClick(	row, column, event){
        //传递到 首页index.vue
        this.$emit('selectRegist',row)
      }
    },
    computed:{
        undealList(){
          let arr = [];
          this.registerList.forEach(item=>{
              if(item.status == 1){
                arr.push(item)
              }
          })
          return arr;
        },
        dealList() {
          let arr = [];
          this.registerList.forEach(item=>{
            if(item.status == 2){
              arr.push(item)
            }
          })
          return arr;
        }
    },
    created() {
      //根据条件查询本人的患者，或者是本科室的患者
      getRegistList({type:this.type}).then(list => {
        this.registerList = list
      })

    }
  }

</script>

<template>
  <div>
     <el-tag> 待接诊的患者</el-tag>
      <el-table :data="undealList" size="mini" row-class-name="tableRowClassName" @row-click="rowClick">
        <el-table-column  type="index" label="序号" width="100px" align="center"></el-table-column>
        <el-table-column prop="name" label="患者姓名" align="center"></el-table-column>
        <el-table-column prop="age" label="年龄"  align="center"></el-table-column>
      </el-table>


    <el-tag> 已接诊的患者</el-tag>
    <el-table :data="dealList" size="mini" row-class-name="tableRowClassName" @row-click="rowClick">
      <el-table-column  type="index" label="序号" width="100px" align="center"></el-table-column>
      <el-table-column prop="name" label="患者姓名" align="center"></el-table-column>
      <el-table-column prop="age" label="年龄"  align="center"></el-table-column>

    </el-table>



  </div>

</template>

<style >
      .tableRowClassName{
        background-color: #f0f9eb;
      }
</style>
